require.config({baseUrl: '/js/lib',urlArgs: "v0.0.1"});
require(['zepto', 'lib'], function($, lib) {
  var fn = {}, lib = new lib();
  $.extend(fn, {
    init: function(){
      
      this.getAlipayAccount();
      this.bindEvent();
    },
    bindEvent: function(){
      $(document).on('tap', '.ui-nav i', function(data){
        location.href = './account_add.html';
      });
    },
    getAlipayAccount: function(){
      lib.onLoading();
      lib.ajx(lib.getReq().ser + 'sellerCenter/getAlipayAccount.action', {}, function(data){
        if(data.infocode === '0'){
          $("body").append(`<ul class="ui-zhifubao"><li><span>${data.info}</span></li></ul>`);
          $(".ui-nav i").text('替换');          
        }
        else if(data.infocode == '2') location.href = './login.html?backUrl=' + lib.getBackUrl();
        else if(data.infocode == '3') $("body").append(`<div><img src="/images/zhifubao.png" style="width: 9.32rem;margin: 1rem auto 0.2rem;"></dt><a href="./account_add.html" class="ui-red-botton" style="background: #288cf0;width: 13.6rem;margin: 1rem auto;box-shadow: #ddd 0px 2px 10px;">+  绑定支付宝账户</a></div>`);
        else lib.showMessage(data.info);
      }, function(){
        lib.showMessage("网络延时，请稍后再试");
      });
    }
  });
  
  fn.init();
});